package 提莫攻击;

class Solution {
    public int findPoisonedDuration(int[] timeSeries, int duration) {
        int ret = 0;
        for(int i = 0; i < timeSeries.length - 1; i++){
            int x = timeSeries[i + 1] - timeSeries[i];
            if(duration >= x){
                ret += x;
            }else{
                ret += duration;
            }
        }
        return ret + duration;
    }
}